/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package svp;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author kandamaran
 */
@Entity
@Table(name = "invoice_products_tbl", catalog = "svpdatabase", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InvoiceProductsTbl.findAll", query = "SELECT i FROM InvoiceProductsTbl i"),
    @NamedQuery(name = "InvoiceProductsTbl.findByInvoiceNo", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.invoiceNo = :invoiceNo"),
    @NamedQuery(name = "InvoiceProductsTbl.findByProductCode", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.productCode = :productCode"),
    @NamedQuery(name = "InvoiceProductsTbl.findByCompanyName", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.companyName = :companyName"),
    @NamedQuery(name = "InvoiceProductsTbl.findByProductName", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.productName = :productName"),
    @NamedQuery(name = "InvoiceProductsTbl.findByUnits", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.units = :units"),
    @NamedQuery(name = "InvoiceProductsTbl.findByQty", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.qty = :qty"),
    @NamedQuery(name = "InvoiceProductsTbl.findByMrp", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.mrp = :mrp"),
    @NamedQuery(name = "InvoiceProductsTbl.findByDiscount", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.discount = :discount"),
    @NamedQuery(name = "InvoiceProductsTbl.findByPrice", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.price = :price"),
    @NamedQuery(name = "InvoiceProductsTbl.findByVat", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.vat = :vat"),
    @NamedQuery(name = "InvoiceProductsTbl.findByFinalPrice", query = "SELECT i FROM InvoiceProductsTbl i WHERE i.finalPrice = :finalPrice")})
public class InvoiceProductsTbl implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "invoice_no")
    private String invoiceNo;
    @Column(name = "product_code")
    private String productCode;
    @Column(name = "company_name")
    private String companyName;
    @Column(name = "product_name")
    private String productName;
    @Column(name = "units")
    private String units;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "qty")
    private Float qty;
    @Column(name = "mrp")
    private Float mrp;
    @Column(name = "discount")
    private Float discount;
    @Column(name = "price")
    private Float price;
    @Column(name = "vat")
    private Float vat;
    @Column(name = "final_price")
    private Float finalPrice;
    @JoinColumn(name = "invoice_no", referencedColumnName = "invoice_no", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private InvoiceTbl invoiceTbl;

    public InvoiceProductsTbl() {
    }

    public InvoiceProductsTbl(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getUnits() {
        return units;
    }

    public void setUnits(String units) {
        this.units = units;
    }

    public Float getQty() {
        return qty;
    }

    public void setQty(Float qty) {
        this.qty = qty;
    }

    public Float getMrp() {
        return mrp;
    }

    public void setMrp(Float mrp) {
        this.mrp = mrp;
    }

    public Float getDiscount() {
        return discount;
    }

    public void setDiscount(Float discount) {
        this.discount = discount;
    }

    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    public Float getVat() {
        return vat;
    }

    public void setVat(Float vat) {
        this.vat = vat;
    }

    public Float getFinalPrice() {
        return finalPrice;
    }

    public void setFinalPrice(Float finalPrice) {
        this.finalPrice = finalPrice;
    }

    public InvoiceTbl getInvoiceTbl() {
        return invoiceTbl;
    }

    public void setInvoiceTbl(InvoiceTbl invoiceTbl) {
        this.invoiceTbl = invoiceTbl;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (invoiceNo != null ? invoiceNo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InvoiceProductsTbl)) {
            return false;
        }
        InvoiceProductsTbl other = (InvoiceProductsTbl) object;
        if ((this.invoiceNo == null && other.invoiceNo != null) || (this.invoiceNo != null && !this.invoiceNo.equals(other.invoiceNo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "svp.InvoiceProductsTbl[ invoiceNo=" + invoiceNo + " ]";
    }
    
}
